Loading...
 

Enumerations and discrete values

Enumerations and discrete values

Enumerations

Enumerations are values with a coding into an integer. For each intended value an external name exists as a multilingual character string.
Data types for enumerations are ENUMINT, ENUMSHORT and ENUMCHAR.
For each data field of one of these enumeration types a transformation table must exist!

Discrete values

Data fields of any other type (except relations) can be linked to a value table. This table specifies individual values without any coding being associated with it.
The values of the table can be understood as preferred values or as the only permissible values of this data field. The table itself makes no statement about this.
Again, the values are multilingual strings. For a data field of the type of a base class (e.g. CX_VALUE) the language-dependent input formats must be observed.

Example: T( "2.0 pieces", "2.0 pieces")
To edit such tables in the database the functions EnterNumeric(), EnterValue(), EnterDate() or EnterTime() should be used(example). These functions carry out the transformation into the different language-dependent representations themselves.

System-wide tables

The System Dictionary contains generally valid tables:

The tables are always transient. They are either loaded from the database - created from persistent objects of the class CX_ENUM_TABLE - or the ClassiX® system reads them from an ASCII file (standard file is CLASSIX.NUM; the description of the syntax can be found here).

Individual tables per object

Objects of class CX_SLOT_ATTRIBUTE (and the classes derived from it) can hold their own table. The dynamic data field enumTable is reserved for this. It refers to an object of the class CX_ENUM_TABLE. This may of course be a persistent object in the database!
Individual tables also appear in both functions: both for enumerations and for the specification of discrete values.

Note: The possibility to manage individual tables per object is inherent in the system. At present, however, only the classes mentioned above make use of it.

The existence of a table controls the shape that a surface object Auto takes:

  • an enumeration data type: Auto mutates to enumeration
  • other data type: Auto mutates into a combo box

Note: The window generated by the OboxEdit statement also uses auto widgets!

Limitation to the specified values

No values can be entered as enumeration data that deviate from the values specified by the table.

An analogue restriction can also be required for the other discrete input values. The dynamic data field limitedValues is reserved for this. It is an enumeration with two values: 0 - any values, 1 - only values from the table are allowed.
Objects of class CX_SLOT_ATTRIBUTE (and the classes derived from it) control the possible entries of a combo box with the data field limitedValues.

Note: This option is also inherent to the system, but is currently only used by the classes mentioned above.

Note: The class CX_SLOT_ATTRIBUTE can restrict the permissible input values for the attribute with constraints. For the formula expressions of the constraints the function ::ElementOf(attribute) is available as a test for the containment of the attribute value in the table.